package com.reach.redis.utils;

import com.reach.redis.aspect.CacheAspect;
import com.reach.redis.manager.SpringContextUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CacheUtils {

	private static final Logger log = LoggerFactory.getLogger(CacheUtils.class);

	public static void clear(String module,String ... keys) {
		clear(module, false,keys);
	}
	
	public static void clear(String module,boolean async,String ... keys) {
		try {
			if(log.isDebugEnabled()) {
				log.debug("Delete redis key is {}.",String.valueOf(keys));
			}
			CacheAspect cacheAspect = (CacheAspect) SpringContextUtil.getBean("cacheAspect");
			cacheAspect.delete(module, async, keys);
		}catch(Exception e){
			log.error(e.getMessage());
		}
	}
	
}
